package com.spacing.app.data;

import java.io.Serializable;
import java.util.ArrayList;


/**
 * @author Paul
 *
 */
@SuppressWarnings("serial")
public class Chapters implements Serializable{
	private ArrayList<Chapter> chapters = new ArrayList<Chapter>();
	
	private String name;	
	
	public void addChapter(Chapter chapter){
		chapters.add(chapter);
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public String getName(){ 
		return name;
	}
	
	public Chapter get(int i){
		return chapters.get(i);
	}
		
	public void getWords1(){
		//TODO
	}
	
	public void getWords2(){
		//TODO
	}
	
	public void getTags(){
		//TODO
	}
	
	public ArrayList<Word> getWords() {
		ArrayList<Word> words = new ArrayList<Word>();
		for (int i = 0; i < chapters.size(); i++) {
			for (int j = 0; j < chapters.get(i).size(); j++) {
				for (int k = 0; k < chapters.get(i).get(j).size(); k++) {
					words.add(chapters.get(i).get(j).get(k));
				}
			}
		}
		return words;
	}

	public ArrayList<String> getNames() {
		ArrayList<String> names = new ArrayList<String>();
		for(int i=0;i<chapters.size();i++){
			names.add(chapters.get(i).getName());
		}
		return names;
	}
	
	public int size(){
		return chapters.size();
		
	}
		
}